<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>商品管理</title>

    <link rel="stylesheet" href="../../layui/css/layui.css">

    <script src="../../layui/js/global.js"></script>

    <style>
        .layui-table-cell{
            text-align:center;
            height: auto;
            white-space: normal;

        }
        .layui-table img{
            max-width:500px}
    </style>
</head>
<body>
<div class="layui-container">
    <!-- 上方面包屑导航-->
    <div>
        <span class="layui-breadcrumb">
          <a href="../index.html" target="_top">首页</a>
          <a><cite>商品管理</cite></a>
        </span>
    </div>
    <!-- 数据检索表单 -->
    <div class="layui-bg-gray" style="margin-top: 15px; padding:15px;">
        <form id="searchForm" class="layui-form" lay-filter="searchForm">
            <div class="layui-form-item">

                <div class="layui-inline">
                    <label class="layui-form-label">商品名称</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="gamename" class="layui-input">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">商品类别</label>
                    <div class="layui-input-inline" style="width: 150px;">
                        <select name="typeid" >
                        </select>
                    </div>
                </div>


                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <button type="button" class="layui-btn layui-btn-warm">搜索</button>
                        <button type="reset" class="layui-btn layui-btn-normal">取消</button>
                    </div>
                </div>

            </div>
        </form>
    </div>
    <!-- 下方表格 -->
    <table id="gameTable" lay-filter="gameTable" class="layui-table-cell"></table>

</div>

<div id="updateDiv" style="display: none">
    <div style="text-align: center">
        <h3 style="margin: 15px">更新商品</h3>
        <form id="updateForm" class="layui-form"  lay-filter="updateForm">
            <div class="layui-form-item">
                <label class="layui-form-label">商品名称</label>
                <div class="layui-input-block">
                    <input type="text" name="gamename" required  lay-verify="required" placeholder="请输入商品名称" autocomplete="off" class="layui-input" style="width:200px">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">商品类别</label>
                <div class="layui-input-block" style="width:400px;">
                    <select name="typeid" >
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">商品价格</label>
                <div class="layui-input-block">
                    <input type="text" name="price" required  lay-verify="required" placeholder="请输入商品价格" autocomplete="off" class="layui-input" style="width:200px">

                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/html" id="gamenameTpl">
    <a href="javascript:void(0);" target="_blank" class="layui-table-link" onclick="detail({{d.id}})">{{d.gamename}}</a>
</script>
<script type="text/html" id="toolbarTpl">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon layui-icon-add-1"></i></button>
        <button class="layui-btn layui-btn-sm" lay-event="dels"><i class="layui-icon layui-icon-delete"></i></button>
    </div>
</script>

<script type="text/html" id="imgTpl">
    <img src="http://localhost:8090/sys/games/{{d.photo}}">
</script>

<script type="text/html" id="rowBar">
    <button class="layui-btn layui-btn-xs" lay-event="edit">更新</button>
    <button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>
</script>

<script src="../../layui/layui.js"></script>
<script src="../../layui/js/sys/GameManager.js"></script>
<script src="../../layui/js/jquery-3.1.1.min.js"></script>
<script>
    var typeAll ;
    layui.use(['layer','table','form' ], function(){
        var layer = layui.layer;
        var table = layui.table ;
        var form = layui.form ;
        var laydate = layui.laydate;
        initTable(table , form) ;
        initTypeSelect(form) ;



        searchBtnInit(table) ;
    });
</script>
</body>
</html>